/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.ofbiz.eclipse.model.webapp.SiteConf.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.ofbiz.eclipse.model.webapp.SiteConf.RedirectParameterType;
import org.ofbiz.eclipse.model.webapp.SiteConf.ResponseType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SaveCurrentViewType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SaveHomeViewType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SaveLastViewType;
import org.ofbiz.eclipse.model.webapp.SiteConf.SiteConfPackage;
import org.ofbiz.eclipse.model.webapp.SiteConf.TypeType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Response Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getRedirectParameter <em>Redirect Parameter</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getSaveCurrentView <em>Save Current View</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getSaveHomeView <em>Save Home View</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getSaveLastView <em>Save Last View</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getType <em>Type</em>}</li>
 *   <li>{@link org.ofbiz.eclipse.model.webapp.SiteConf.impl.ResponseTypeImpl#getValue <em>Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ResponseTypeImpl extends EObjectImpl implements ResponseType {
	/**
	 * The cached value of the '{@link #getRedirectParameter() <em>Redirect Parameter</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRedirectParameter()
	 * @generated
	 * @ordered
	 */
	protected EList<RedirectParameterType> redirectParameter;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getSaveCurrentView() <em>Save Current View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveCurrentView()
	 * @generated
	 * @ordered
	 */
	protected static final SaveCurrentViewType SAVE_CURRENT_VIEW_EDEFAULT = SaveCurrentViewType.FALSE;

	/**
	 * The cached value of the '{@link #getSaveCurrentView() <em>Save Current View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveCurrentView()
	 * @generated
	 * @ordered
	 */
	protected SaveCurrentViewType saveCurrentView = SAVE_CURRENT_VIEW_EDEFAULT;

	/**
	 * This is true if the Save Current View attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean saveCurrentViewESet;

	/**
	 * The default value of the '{@link #getSaveHomeView() <em>Save Home View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveHomeView()
	 * @generated
	 * @ordered
	 */
	protected static final SaveHomeViewType SAVE_HOME_VIEW_EDEFAULT = SaveHomeViewType.FALSE;

	/**
	 * The cached value of the '{@link #getSaveHomeView() <em>Save Home View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveHomeView()
	 * @generated
	 * @ordered
	 */
	protected SaveHomeViewType saveHomeView = SAVE_HOME_VIEW_EDEFAULT;

	/**
	 * This is true if the Save Home View attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean saveHomeViewESet;

	/**
	 * The default value of the '{@link #getSaveLastView() <em>Save Last View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveLastView()
	 * @generated
	 * @ordered
	 */
	protected static final SaveLastViewType SAVE_LAST_VIEW_EDEFAULT = SaveLastViewType.FALSE;

	/**
	 * The cached value of the '{@link #getSaveLastView() <em>Save Last View</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSaveLastView()
	 * @generated
	 * @ordered
	 */
	protected SaveLastViewType saveLastView = SAVE_LAST_VIEW_EDEFAULT;

	/**
	 * This is true if the Save Last View attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean saveLastViewESet;

	/**
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected static final TypeType TYPE_EDEFAULT = TypeType.NONE;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected TypeType type = TYPE_EDEFAULT;

	/**
	 * This is true if the Type attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean typeESet;

	/**
	 * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected static final String VALUE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected String value = VALUE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ResponseTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SiteConfPackage.Literals.RESPONSE_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<RedirectParameterType> getRedirectParameter() {
		if (redirectParameter == null) {
			redirectParameter = new EObjectContainmentEList<RedirectParameterType>(RedirectParameterType.class, this, SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER);
		}
		return redirectParameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SaveCurrentViewType getSaveCurrentView() {
		return saveCurrentView;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSaveCurrentView(SaveCurrentViewType newSaveCurrentView) {
		SaveCurrentViewType oldSaveCurrentView = saveCurrentView;
		saveCurrentView = newSaveCurrentView == null ? SAVE_CURRENT_VIEW_EDEFAULT : newSaveCurrentView;
		boolean oldSaveCurrentViewESet = saveCurrentViewESet;
		saveCurrentViewESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW, oldSaveCurrentView, saveCurrentView, !oldSaveCurrentViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetSaveCurrentView() {
		SaveCurrentViewType oldSaveCurrentView = saveCurrentView;
		boolean oldSaveCurrentViewESet = saveCurrentViewESet;
		saveCurrentView = SAVE_CURRENT_VIEW_EDEFAULT;
		saveCurrentViewESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW, oldSaveCurrentView, SAVE_CURRENT_VIEW_EDEFAULT, oldSaveCurrentViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetSaveCurrentView() {
		return saveCurrentViewESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SaveHomeViewType getSaveHomeView() {
		return saveHomeView;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSaveHomeView(SaveHomeViewType newSaveHomeView) {
		SaveHomeViewType oldSaveHomeView = saveHomeView;
		saveHomeView = newSaveHomeView == null ? SAVE_HOME_VIEW_EDEFAULT : newSaveHomeView;
		boolean oldSaveHomeViewESet = saveHomeViewESet;
		saveHomeViewESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW, oldSaveHomeView, saveHomeView, !oldSaveHomeViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetSaveHomeView() {
		SaveHomeViewType oldSaveHomeView = saveHomeView;
		boolean oldSaveHomeViewESet = saveHomeViewESet;
		saveHomeView = SAVE_HOME_VIEW_EDEFAULT;
		saveHomeViewESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW, oldSaveHomeView, SAVE_HOME_VIEW_EDEFAULT, oldSaveHomeViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetSaveHomeView() {
		return saveHomeViewESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SaveLastViewType getSaveLastView() {
		return saveLastView;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSaveLastView(SaveLastViewType newSaveLastView) {
		SaveLastViewType oldSaveLastView = saveLastView;
		saveLastView = newSaveLastView == null ? SAVE_LAST_VIEW_EDEFAULT : newSaveLastView;
		boolean oldSaveLastViewESet = saveLastViewESet;
		saveLastViewESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW, oldSaveLastView, saveLastView, !oldSaveLastViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetSaveLastView() {
		SaveLastViewType oldSaveLastView = saveLastView;
		boolean oldSaveLastViewESet = saveLastViewESet;
		saveLastView = SAVE_LAST_VIEW_EDEFAULT;
		saveLastViewESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW, oldSaveLastView, SAVE_LAST_VIEW_EDEFAULT, oldSaveLastViewESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetSaveLastView() {
		return saveLastViewESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TypeType getType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType(TypeType newType) {
		TypeType oldType = type;
		type = newType == null ? TYPE_EDEFAULT : newType;
		boolean oldTypeESet = typeESet;
		typeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__TYPE, oldType, type, !oldTypeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetType() {
		TypeType oldType = type;
		boolean oldTypeESet = typeESet;
		type = TYPE_EDEFAULT;
		typeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, SiteConfPackage.RESPONSE_TYPE__TYPE, oldType, TYPE_EDEFAULT, oldTypeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetType() {
		return typeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getValue() {
		return value;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValue(String newValue) {
		String oldValue = value;
		value = newValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SiteConfPackage.RESPONSE_TYPE__VALUE, oldValue, value));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER:
				return ((InternalEList<?>)getRedirectParameter()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER:
				return getRedirectParameter();
			case SiteConfPackage.RESPONSE_TYPE__NAME:
				return getName();
			case SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW:
				return getSaveCurrentView();
			case SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW:
				return getSaveHomeView();
			case SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW:
				return getSaveLastView();
			case SiteConfPackage.RESPONSE_TYPE__TYPE:
				return getType();
			case SiteConfPackage.RESPONSE_TYPE__VALUE:
				return getValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER:
				getRedirectParameter().clear();
				getRedirectParameter().addAll((Collection<? extends RedirectParameterType>)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__NAME:
				setName((String)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW:
				setSaveCurrentView((SaveCurrentViewType)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW:
				setSaveHomeView((SaveHomeViewType)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW:
				setSaveLastView((SaveLastViewType)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__TYPE:
				setType((TypeType)newValue);
				return;
			case SiteConfPackage.RESPONSE_TYPE__VALUE:
				setValue((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER:
				getRedirectParameter().clear();
				return;
			case SiteConfPackage.RESPONSE_TYPE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW:
				unsetSaveCurrentView();
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW:
				unsetSaveHomeView();
				return;
			case SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW:
				unsetSaveLastView();
				return;
			case SiteConfPackage.RESPONSE_TYPE__TYPE:
				unsetType();
				return;
			case SiteConfPackage.RESPONSE_TYPE__VALUE:
				setValue(VALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SiteConfPackage.RESPONSE_TYPE__REDIRECT_PARAMETER:
				return redirectParameter != null && !redirectParameter.isEmpty();
			case SiteConfPackage.RESPONSE_TYPE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case SiteConfPackage.RESPONSE_TYPE__SAVE_CURRENT_VIEW:
				return isSetSaveCurrentView();
			case SiteConfPackage.RESPONSE_TYPE__SAVE_HOME_VIEW:
				return isSetSaveHomeView();
			case SiteConfPackage.RESPONSE_TYPE__SAVE_LAST_VIEW:
				return isSetSaveLastView();
			case SiteConfPackage.RESPONSE_TYPE__TYPE:
				return isSetType();
			case SiteConfPackage.RESPONSE_TYPE__VALUE:
				return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", saveCurrentView: ");
		if (saveCurrentViewESet) result.append(saveCurrentView); else result.append("<unset>");
		result.append(", saveHomeView: ");
		if (saveHomeViewESet) result.append(saveHomeView); else result.append("<unset>");
		result.append(", saveLastView: ");
		if (saveLastViewESet) result.append(saveLastView); else result.append("<unset>");
		result.append(", type: ");
		if (typeESet) result.append(type); else result.append("<unset>");
		result.append(", value: ");
		result.append(value);
		result.append(')');
		return result.toString();
	}

} //ResponseTypeImpl
